/**
 * 导线
 */
GuideLine = Widget.extend({
	ctor:function(parent){
		this._super();
		parent.addChild(this,30);
		this.init();
		this.setTag(TAG_GUIDELINE);
	},
	init:function(){
		this.setCascadeOpacityEnabled(true);
		this.setScale(0.8);

		//蓄电池   与   开关
		this.line1 = new Button(this, 1, TAG_LINE1, "#line/line1.png", this.callback);
		this.line1.setPosition(cc.p(200,520));
		this.line1.setRotation(-28);
		this.line1.setScale(0.5);
		//开关   与   滑动变阻器
		this.line2 = new Button(this, 2, TAG_LINE2, "#line/line2.png", this.callback);
		this.line2.setPosition(cc.p(200,520));
		this.line2.setScale(0.5);
		//滑动变阻器   与   电流表
		this.line3 = new Button(this, 3, TAG_LINE3, "#line/line3.png", this.callback);
		this.line3.setPosition(cc.p(200,520));
		this.line3.setRotation(-20);
		this.line3.setScale(0.5);
		//电流表   与  烧瓶（右）
		this.line4 = new Button(this, 4, TAG_LINE4, "#line/line4.png", this.callback);
		this.line4.setPosition(cc.p(200,520));
		this.line4.setRotation(-50);
		this.line4.setScale(0.5);
		//烧瓶（左）   与   烧瓶（右）
		this.line5 = new Button(this, 5, TAG_LINE5, "#line/line5.png", this.callback);
		this.line5.setPosition(cc.p(200,520));
		this.line5.setScale(0.5);
		//蓄电池   与  烧瓶（左）
		this.line6 = new Button(this, 6, TAG_LINE6, "#line/line6.png", this.callback);
		this.line6.setPosition(cc.p(200,520));
		this.line6.setRotation(30);
		this.line6.setScale(0.5);
		
		this.callNext = cc.callFunc(function(){
			gg.flow.next();
		}, this);
		this.callNext.retain();
	},
	callback:function (p){
		var action=gg.flow.flow.action;
		var func=cc.callFunc(this.actionDone,this);
		switch(p.getTag()){
		case TAG_LINE6:
			this.line1.runAction(cc.spawn(cc.moveTo(0.6, cc.p(541,269)),cc.scaleTo(0.6, 1),cc.rotateTo(0.6, 0)));
			this.line2.runAction(cc.sequence(cc.delayTime(0.6),cc.spawn(cc.moveTo(0.6, cc.p(991,158)),cc.scaleTo(0.6, 1),cc.rotateTo(0.6, 0))));
			this.line3.runAction(cc.sequence(cc.delayTime(1.2),cc.spawn(cc.moveTo(0.6, cc.p(1398,311)),cc.scaleTo(0.6, 1),cc.rotateTo(0.6, 0))));
			this.line4.runAction(cc.sequence(cc.delayTime(1.8),cc.spawn(cc.moveTo(0.6, cc.p(1057,485)),cc.scaleTo(0.6, 1),cc.rotateTo(0.6, 0))));
			this.line5.runAction(cc.sequence(cc.delayTime(2.4),cc.spawn(cc.moveTo(0.6, cc.p(800,602)),cc.scaleTo(0.6, 1),cc.rotateTo(0.6, 0))));
			this.line6.runAction(cc.sequence(cc.delayTime(3),cc.spawn(cc.moveTo(0.6, cc.p(484,515)),cc.scaleTo(0.6, 1),cc.rotateTo(0.6, 0)),cc.delayTime(0.5),cc.callFunc(function() {
				gg.flow.next();
			}, this)));
			break;
		default:
			break;
		}
	},
	actionDone:function(p){
		var action=gg.flow.flow.action;
		switch(p.getTag()){
		case TAG_FLASK1:

			break;
		case TAG_FLASK2:

			break;
		default:
			break;
		}
		gg.flow.next();
	},
	onExit:function(){
		this._super();
		this.callNext.release();
	}
})